import {createRouter, createWebHistory} from "vue-router";
import Login from "../views/Login.vue";
import Layout from "../views/Layout.vue";
import UserInfo from "../views/user/UserInfo.vue";
import UserManagement from "../views/user/UserManagement.vue";
import ResetPassword from "../views/user/resetPassword.vue";
import Index from "../views/index/Index.vue";
import HouseList from "../views/house/list.vue";
import listdetail from "../views/house/listdetail.vue";
import House3DView from "../views/house/House3DView.vue";
import HouseDetail from "../views/house/Detail.vue";
import Detail from "../views/house/HouseDetail.vue";
import TradeInfoPage from '../views/trade/transactiondata.vue';
import People from '../views/trade/people.vue';
import Chart from '../views/money/chart.vue';
import Transaction from "../views/afterSale/Transaction.vue";
import Check from "../views/afterSale/check.vue";
import Contract from "../views/afterSale/contract.vue";
import Repair from "../views/afterSale/Repair.vue";
import Income from '../views/money/income.vue';
function UserList() {

}

function RestPassword() {}

// 定义路由关系
const routes = [
  {
    path: '/login',
    component: Login
  },  // 一级路由

  {
    path: '/',
    redirect: '/login',  // 重定向
    component: Layout,
    // 子路由
    children: [
      { path: '/index', component: Index },
      { path: '/user/resetPassword', component: RestPassword },
      { path: '/house/list/list', component: HouseList },
      {
        path: '/house/listdetail/:id',
        name: 'listdetail',
        component:listdetail,
        props: true
      },
      { path: '/house/3d', name: 'house3d', component: House3DView },
      {
        path: '/house/detail',
        name: 'detail',
        component: Detail
      },
      {
        path: '/house/detail/:id',
        name: 'HouseDetail',
        component: HouseDetail,
        props: true  // 启用props接收参数
      },
      {path: '/index', component: Index},
      {path: '/user/list', component: UserManagement},
      {path: '/user/info', component: UserInfo},
      {path: '/user/resetPassword', component: RestPassword} ,
      {path: '/user/resetPassword', component: ResetPassword},
      {path: '/user/tenants', component: () => import('../views/user/TenantsList.vue')},
      {path: '/user/reservations', component: () => import('../views/user/ReservationsList.vue')},
      {path: '/user/behavior', component: () => import('../views/user/UserBehaviorAnalysis.vue')},
      {path: '/user/activity', component: () => import('../views/user/UserActivityStats.vue')},
      { path: '/afterSale/repair', component: Repair },
      {path: '/afterSale/transaction', component: Transaction },
      { path: '/afterSale/contract',  component: Contract},
      { path: '/afterSale/check',  component:Check},
      {path: '/trade/transactionData', component: TradeInfoPage },
      {path: '/trade/people', component: People },
      {path: '/money/chart', component:Chart },
      {path: '/money/income', component:Income},


    ]
  }


]

const router = createRouter({
  history: createWebHistory(), //  路由模式
  routes: routes
})

//导出暴露
export default router
